home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / dino / dino_bot.1 / source / shell / shell.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-10  |  667 b   |  37 lines

  1. #define BOOL char
  2. #define FALSE 0
  3. #define TRUE 1
  4.  
  5. #define FILENAME 256
  6. #define MESSLEN 256
  7. #define MAX_STRING 80
  8.  
  9. #define MAX_LINE 2048
  10. static int buf_count = 0;
  11. static int eof = 0;
  12. char *get_line(desc)
  13.     int desc;
  14.     {
  15.     static char buf[MAX_LINE];
  16.     static char *buf_pt;
  17.  
  18.     static char line[MAX_LINE];
  19.     register char *line_pt = line -1;
  20.  
  21.     line[0] = '\0';
  22.     if (eof) return line;
  23.     do{
  24.         if (buf_count == 0){
  25.             buf_count = read(desc, buf, MAX_LINE);
  26.             if (buf_count == 0) eof = 1;
  27.             buf_pt = buf;}
  28.         if (!eof)
  29.             *(++line_pt) = *(buf_pt++);
  30.         buf_count--;
  31.         } while ((*line_pt != '\n') && (line_pt != &line[MAX_LINE-1]) && !eof);
  32.     *(++line_pt) = '\0';
  33.     return line;
  34.     };
  35.  
  36.  
  37.